<template>
	<view>
		<view class="list" v-if="list.length > 0">
			<view class="list-item" v-for="it in list">
				<view class="list-item-l">
					<view class="list-item-l-title">{{it.name}}</view>
					<view class="list-item-l-time">{{it.add_time}}</view>
				</view>
				<view class="list-item-r">
					+{{it.price}}
				</view>
			</view>
		</view>
		<view class="noData" style="padding-bottom:120rpx;" v-else>
			<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
		</view>
	</view>
</template>

<script>
	import {
		IncomeDetails
	} from '@/common/http/api.js'
	export default {
		data() {
			return {
				//分页
				params:{
					page: 1
				},
				isList: true, 
				list: [],
			};
		},
		methods:{
			reload(){
				this.list = []
				this.params.page = 1
				this.init()
			},
			onLoad(e) {
				this.reload()
			},
			init(){
				uni.showLoading()
				IncomeDetails(this.params).then(res=>{
					uni.hideLoading()
					if(Array.isArray(res.data) && res.data.length > 0) {
						if(this.params.page === 1) {
							this.list = res.data
						} else {
							this.list = this.list.concat(res.data)
						}
					} else {
						this.isList = false
					}
				})
			},
			
		}
	}
</script>

<style lang="scss">
	page {
		background: #F6F7F8;
	}
	.list {
		width: 100%;
		.list-item {
			margin-bottom: 16rpx;
			width: 100%;
			box-sizing: border-box;
			padding: 26rpx 48rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: white;
			.list-item-l {
				.list-item-l-title {
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 30rpx;
					color: #131313;
					margin-bottom: 33rpx;
				}
				.list-item-l-time {
					font-family: PingFang SC;
					font-weight: 300;
					font-size: 24rpx;
					color: #999999;
				}
			}
			.list-item-r {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 36rpx;
				color: #EC1414;
			}
		}
	}
</style>
